<h3 class="title">
	&nbsp;首页  &gt; <a href="<?=Base::adminUrl('store', 'index', array('res_id' => $res_id));?>"><?=h($storeInfo['name'])?></a>
				&gt; <a href="<?=Base::adminUrl('dish', 'index', array('res_id' => $res_id));?>">菜品管理</a> &gt;
<?php
	$acts = array(
		'create' => '添加',
		'modify' => '编辑',
	);
	echo $acts[$action];
?>
</h3>

<form method="post" name="form1" action="<?=Base::adminUrl('dish', 'process');?>"  onsubmit="return checkform();">
  <input type="hidden" name="action" value="<?=$action;?>" />
  <input type="hidden" name="res_id" value="<?=$res_id;?>" />
  <input type="hidden" name="dish_id" value="<?=$data['dish_id'];?>" />
  <div class="tags">
    <div id="tagstitle">
    	<a href="#" id="one1" onclick="setTab('one',1,2)" class="hover">基本信息</a>
    	<a href="#" id="one2" onclick="setTab('one',2,2)">图片信息</a>
    </div>
    <div id="tagscontent">
      <div id="con_one_1">
        <table width="100%" border="0" cellspacing="2" cellpadding="0" id="table1" class="formtable">
          <tr>
            <td width="19%" align="right"><span class="title">菜品名称</span></td>
            <td width="1%">&nbsp;</td>
            <td width="80%"><input type="text" name="name" id="name" size="40" class="skey" value="<?=h($data['name']);?>" />
              &nbsp;<font color="red">*</font></td>
          </tr>
          <tr>
            <td width="19%" align="right"><span class="title">附加别名</span></td>
            <td width="1%">&nbsp;</td>
            <td width="80%"><input type="text" name="subname" id="subname" size="40" class="skey" value="<?=h($data['subname']);?>" />
    			 <span class="tips"><a href="javascript:tipsbox('可填写缩略语，或者更完整的称谓');">查看帮助</a></span></td>
          </tr>
          <tr>
            <td width="19%" align="right"><span class="title">自定义分类</span></td>
            <td width="1%">&nbsp;</td>
            <td width="80%"><select id="dish_cat_id" name="dish_cat_id" class="ssel">
	    		<option value="0">（默认分类）</option>
		        <?php
					foreach($category as $item){
						$sel = ($item['dish_cat_id'] == $data['dish_cat_id']) ? ' selected' : '';
						?><option value="<?=$item['dish_cat_id']?>"<?=$sel;?>><?=$item['dish_cat_name']?></option><?php
					}
				?>
              </select>
              &nbsp;<font color="red">*</font> <span class="tips"><a href="#;">点击这里设置分类</a></span></td>
          </tr>
          <tr>
            <td align="right"><span class="title">价格</span></td>
            <td>&nbsp;</td>
            <td>
              <input type="text" name="price" size="20" class="skey-s" value="<?=doubleval($data['price']);?>" /> 元 </td>
          </tr>
          <tr>
            <td align="right"><span class="title">菜品描述</span></td>
            <td>&nbsp;</td>
            <td><textarea class="stxt" rows="6" cols="40" id="description" name="description"><?=h($data['description']);?></textarea></td>
          </tr>
          <tr>
            <td align="right">&nbsp;</td>
            <td>&nbsp;</td>
            <td>&nbsp;</td>
          </tr>
        </table>
      </div>
      <div id="con_one_2" style="display:none">
      	<table width="100%" border="0" cellspacing="2" cellpadding="0" id="table3" class="formtable">
          <tr>
            <td width="19%" align="right"><span class="title">餐品图片</span></td>
            <td width="1%">&nbsp;</td>
            <td width="80%">
            <img width="145" height="120" id="storepic" src="<?=empty($data['picture']) ? STATIC_URL.'img/store_nopic.jpg' : UPLOAD_URL.$data['picture'];?>" />
            <br />
            地址： <input type="text" name="picture" id="picture" size="40" class="skey-l" value="<?=h($data['picture']);?>" readonly1="readonly" />
            <br />
            上传： <input type="file" name="upfile" id="upfile" />
            &nbsp;(145x120) &nbsp;&nbsp; <font color="red">*</font></td>
          </tr>
         </table>
      </div>
    </div>
  </div>
  <div class="blank20"></div>
  <input type="submit" name="dosubmit" value=" 提交 " class="button" />
  <input type="button" onclick="javascript:location.href='<?=Base::adminUrl('dish', 'index', array('res_id' => $res_id));?>'" value=" 返回 " class="button" />
</form>

<script type="text/javascript" language="javascript" src="<?=STATIC_URL;?>js/ajaxupload.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
	//图片上传
	new AjaxUpload($("#upfile"), {
		action: '?c=upload&a=thumb',
		name: 'picture',
		data: {
			'width'   : 120,
			'height'  : 120,
			'dosubmit': 'yes'
		},
		autoSubmit: true,
		responseType: 'json',
		onSubmit : function(file, ext){
			this.disable();
		},
		onComplete: function(file, response){
			this.enable();
			if(response.err == ""){
				alert("OK");
				$('#storepic').attr('src', '<?=UPLOAD_URL;?>' + response.msg.url);
				$('#picture').val(response.msg.url);
			}else if(response.err){
				alert(response.err);
			}else{
				alert("文件上传接口错误，请重试！");
			}
		}
	});
});
</script>